<?php
namespace Home\Controller;

use Think\Controller;
use Util\AccessController;

header('Access-Control-Allow-Origin:*');//允许所有来源访问
header('Access-Control-Allow-Method:POST,GET');//允许访问的方式
class IndexController extends Controller {

    public function Index() {
        $this->display('Index/index');
    }

    public function GetModule() {
        $PAGE =  $_POST['page'] ? $_POST['page'] : 0;
        $LS = Service('Index', 'home');
        $data['TYPE1'] = $LS->query(array('TYPE' => 1,'PAGE'=>$PAGE));
        $data['TYPE2'] = $LS->query(array('TYPE' => 2,'PAGE'=>$PAGE));
        $data['TYPE3'] = $LS->query(array('TYPE' => 3,'PAGE'=>$PAGE));
        $data = json_return($data);
        echo json_encode($data);
    }

    public function GetGoods() {
        $PAGE =  $_POST['page'] ? $_POST['page'] : 0;
        $LS = Service('Index', 'goods');
        $data['TYPE1'] = $LS->query(array('TYPE' => 1,'PAGE'=>$PAGE));
        $data['TYPE2'] = $LS->query(array('TYPE' => 2,'PAGE'=>$PAGE));
        $data = json_return($data);
        echo json_encode($data);
    }


}